package top.lileix.mybatis.generator.x.domain.mapper;

import java.util.ArrayList;
import java.util.List;

import top.lileix.mybatis.generator.x.domain.Column;
import top.lileix.mybatis.generator.x.domain.Table;

public class ResultMap {
    public Result id;
    public List<Result> results;

    public ResultMap(Table t) {
	results = new ArrayList<>();
	for (Column c : t.getColumns()) {
	    if (c.getPrimaryKey()) {
		id = new Result();
		id.column = c.getColumnName();
		id.jdbcType = c.getColumnType();
		id.property = c.getFieldName();

	    } else {
		Result r = new Result();
		r.column = c.getColumnName();
		r.jdbcType = c.getColumnType();
		r.property = c.getFieldName();
		results.add(r);
	    }
	}
    }
}
